import random
import sys

instance_num = 2000000 
dimension = 400000000L


def sample(begin, end, num):
    features=[]
    while(len(features)<num):
        feature = long(random.random()*end);
        if feature in features:
            continue
        else:
            features.append(feature)
    return features

i=0
while i < instance_num:
    i+=1
    feature_num = random.randint(0, 100)
    show = random.randint(0, 100)
    click = random.randint(0, min(show,10))
    sys.stdout.write("%d\t%d" % (click, show) )
    features = sample(0, dimension, feature_num)
    j = 0
    for feature in features:
        sys.stdout.write("\t%d\t1" % feature)
    sys.stdout.write("\n")

